package com.example.demo.controller;

import com.example.demo.service.UserServiceImpl;
import com.example.demo.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    UserServiceImpl userService;

    @RequestMapping(value = "/addUser", method = RequestMethod.POST)
    public String addUser(@RequestParam("username") String username,
                        @RequestParam("password") String password
                        ){
        userService.addUser(username, password);
        return Result.okGetString();
    }

    @RequestMapping("/hello")
    public String hello(){
        return "hello Word";
    }

}
